package com.demo1215;

import com.google.gson.Gson;
import org.junit.Test;

public class GsonTest {

    @Test
    public  void test01(){
        Student student = new Student(1,"张三",20,"清华小学");
        Gson gson = new Gson();
        String studentStr = gson.toJson(student);
        System.out.println(studentStr);
        Student student1 = gson.fromJson(studentStr, Student.class);
        System.out.println(student1);
    }
}
